<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div{
            width: 200px;
            height: 200px;
            background-color: #000;
            color: #fff;
            border: 10px solid #000;
        }
    </style>
</head>
<body>
    <div>鼠标移入改变样式,鼠标移出回复</div>
</body>
<script>
    let div = document.querySelector("div")
    div.addEventListener('mouseover',function(e){
        div.style.backgroundColor="#cecece"
        div.style.borderColor="red"
        div.style.color="red"
        div.style.cursor="crosshair"
    })
    div.addEventListener('mouseout',function(e){
        div.style=""
    })
</script>
</html>